#ifndef THREADLINKS_H
#define THREADLINKS_H

#include <QObject>
#include <QtNetwork>
#include  <QImage>

#include "SocketTCP.h"
#include "Protocole.h"



class ThreadLinks : public QObject
{
    Q_OBJECT

public:
    ThreadLinks();
    ~ThreadLinks();
    void    setIpServer(QString ipServer);
    void    setPort(QString port);
    QString getIp();
    void    sendDataTo  (char* data, quint32 sizeData, QTcpSocket *socket);
    void    sendData    (char* data, quint32 sizeData);

private:
    QList<QTcpSocket*> listClients;
    SocketTCP * soc;
    QString ipServer;
    QString port;
    QTcpServer      *server;
    QTcpSocket      *client;

    headerTCP       header;
    char            *buffer;

    quint16 blockSize;




public slots:
    void run();
    void addNewClient(QTcpSocket* client);
    void receiveData();
    void createClient();
    void createServer();
    void saveIP(QString);


signals:
    void new_msg_chat(QString);


};

#endif // THREADLINKS_H
